package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.WechatZhinengShibie;
import com.ruoyi.system.service.IWechatZhinengShibieService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 智能识别预警Controller
 * 
 * @author ruoyi
 * @date 2022-06-02
 */
@RestController
@RequestMapping("/system/shibie")
public class WechatZhinengShibieController extends BaseController
{
    @Autowired
    private IWechatZhinengShibieService wechatZhinengShibieService;

    /**
     * 查询智能识别预警列表
     */
    @PreAuthorize("@ss.hasPermi('system:shibie:list')")
    @GetMapping("/list")
    public TableDataInfo list(WechatZhinengShibie wechatZhinengShibie)
    {
        startPage();
        List<WechatZhinengShibie> list = wechatZhinengShibieService.selectWechatZhinengShibieList(wechatZhinengShibie);
        return getDataTable(list);
    }

    /**
     * 导出智能识别预警列表
     */
    @PreAuthorize("@ss.hasPermi('system:shibie:export')")
    @Log(title = "智能识别预警", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WechatZhinengShibie wechatZhinengShibie)
    {
        List<WechatZhinengShibie> list = wechatZhinengShibieService.selectWechatZhinengShibieList(wechatZhinengShibie);
        ExcelUtil<WechatZhinengShibie> util = new ExcelUtil<WechatZhinengShibie>(WechatZhinengShibie.class);
        util.exportExcel(response, list, "智能识别预警数据");
    }

    /**
     * 获取智能识别预警详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:shibie:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return AjaxResult.success(wechatZhinengShibieService.selectWechatZhinengShibieById(id));
    }

    /**
     * 新增智能识别预警
     */
    @PreAuthorize("@ss.hasPermi('system:shibie:add')")
    @Log(title = "智能识别预警", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WechatZhinengShibie wechatZhinengShibie)
    {
        return toAjax(wechatZhinengShibieService.insertWechatZhinengShibie(wechatZhinengShibie));
    }

    /**
     * 修改智能识别预警
     */
    @PreAuthorize("@ss.hasPermi('system:shibie:edit')")
    @Log(title = "智能识别预警", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WechatZhinengShibie wechatZhinengShibie)
    {
        return toAjax(wechatZhinengShibieService.updateWechatZhinengShibie(wechatZhinengShibie));
    }

    /**
     * 删除智能识别预警
     */
    @PreAuthorize("@ss.hasPermi('system:shibie:remove')")
    @Log(title = "智能识别预警", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids)
    {
        return toAjax(wechatZhinengShibieService.deleteWechatZhinengShibieByIds(ids));
    }
}
